working prototype of spar.pl
made minor edits here and there