Attempt at working... not so well though