Updates css rewrite logic to be more strict and adds additional documentation.