refactor according to rachel suggestions