Various cleanup, added some constants