Fixed more bugs in smk.
split smk into components