added tests and updated main