Many code enhancements