cleaned up code
squashed bugs