The first part was fairly straightforward.

http://forum.logicalgamers.com/guide...tml#post320654