adjusted some constants and refactored methods for usability