adjust paths; clean up code