Did my homework, added some more functions to support getting the correct result for systems.