tidy code & upgrated to v0.5