cleaned up the code smor.