Refactor and soem documentation