Fixed indentation, removed an unnecessary null check and added two tests