moved out some definitions for cleaner layout and for safety