Finished most functionality of middle end and backend