This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
These are open-ended questions that can't really be answered in forum posts; it would take way too much time for anyone to do so. But they can be answered by going through the source code (as I have done in the past to learn how the library works). I suggest you start with that, and if you have a specific question you come back here for help.
And, again, you need to fix your display name now.