Cleaned up and cut out unused code.