Split stuff up into more functions, delete still doesn't work well