Cleaned up and fixed some src code