added comments, cleaned input/outputs