refactor and syntax/format polish