code update.

Major refactor underway.
Currently not working :'(