Tidied code and added more transparent annotation