implemented timeout method for select. Works as standalone script currently