locking stuff, 90% done