Fixed up code to comply with requirements