Fixed bug that lead to the creation of unnecessary functions.