refactor some scripts into grunt