setting some constants and reorganizing