Some Code Improvements