Reimplemented all features from master