Rewritten in angular :)