a lot of custom fixes and improvemnets