Moved code around, fixes.