Added function and also pep 8 formatting