add documentation. remove unnecessary functions.