Added testing functions and further comments