major rework and upgrade