added some unit tests and front end logic