applied minor styling, added uri parsing and tidied creation