Added SSL implementation and some cleanup