General fixes

Working version