Basic functions and some bugs.