refactor based on notes