several performance optimizations
layout fixes :D