refactored to make it work with GH pages