Added stat and destroy as functions. Cleanup to the if command. General fixes.