code streamlining and cleanup