got rid of useless variables
ordering stuff
cleanup