Clean-up the code a bit. Nosetests are working now