Tidied and indented code