Added documentation, removed unnecessary functions