cleaned code, simplification