Organized and minor bug fixes