best practices + comments

Add comments and attempted to make code cleaner