fixed issues with tab indentation; refactoring