Editing some functionality for better performance.