Some code restyle and tests added