Split everything up in some files

Also implement session stuff and persistent storage