update constants and all around general refactor