added test and simplified
Added runtests