barely working. needs a cleanup