Updated requirements specification and some code cleanup