Fixed sorting by proposals
Moved constants to separate file and fixed bugs