Add comments and tidy