Made the code somewhat useable for others