everything working. to do: optimize