updated solutions to use a common method