Wrote some tests, implemented coolo's and adrian's feedback