Cleanup

Cleanup of code in preperation for new features