Cleanup and Bug fixes