Bunch of changes, added some javadocs and a partial keep-alive