Added SRMs 517 and 617, cleaned up some code