Reimplemented parts and fixed migration bugs