Added @assert directive for writing tests. Minor code cleanup.