cleaned up a lot of code, removed srm stuff, bash style if [[
more cleanups