first commit, added both functions with some explanation