WIP
Nearly finished the functionality