updated with tests