Bug fix on css malformed rule, code refactor and small improvements.