Removed postgres-specific queries. Remove url construction from javascript code and inject urls into template via <link> tags.