code refactoring, better output, commenting code