refactored with OOJS