Cleanup and fixing #1