Added initial code

Added initial code, which was developed by Simon Woods.
http://mathematica.stackexchange.com/a/15948/12