added comments, put both functions in one file