Added .sm parsing (almost works), code reformating