Adding mostly finalized implementation before I end up breaking
everything