Tests added and code reformatted