Finished and tested QSM.java