added comments for clarity and starting work on order of operations