Various code improvements. Large amounts of framework ports completed.