added additional tests and implementation