Cleaned up resources and added some new functions.