attempt at function