Fix readability/functionality bugs