cleaned code
fixed tests