added sinatra support and modified angular code