adding the noise removal flag to the assertion funciton, code cleanup by splitting some unreadable long lines