updated code and tests to v0.5