Refactored into API
first working web version