finished returning filtered posts

distance formula works as well, absorbed LUA function declaration into the script's logic