code cleanup & commenting