added type checking and cleaned a little bit for submission script