added constants, implemented arrowhit and cleaned code